/*!
    \file    LED.h
    \brief   

    \version 2021-07-26, V3.0.0,  migrate from STM8
*/

#ifndef __LED__
#define __LED__


#include "gd32f10x.h"
#include "Bsp.h"


typedef struct 
{
    uint8_t Mode;            // when no fault,0-always light,1-0.5Hz twinkle
    int16_t Code;
    int16_t DispTimeCnt;     //
    int16_t DispTimeCmp;     // 200ms
    int16_t DispTimePrd;     // 500ms
    int16_t DispNumCnt;      //
    int16_t DispNumCmp;      //
    int16_t DispNumPrd;      // 
    int16_t DispTimeCnt2;    //
    int16_t DispTimeCmp2;    // 1S
    int16_t DispTimePrd2;    // 2S
}tLED_REG;

#define tLED_REG_DEFAULT {\
    1,\
    0,\
    0,\
    (SYS_TICK_SLOW_FREQ/5),\
    (SYS_TICK_SLOW_FREQ/2),\
    0,\
    0,\
    15,\
    0,\
    (SYS_TICK_SLOW_FREQ),\
    (SYS_TICK_SLOW_FREQ<<1)}

extern tLED_REG LedReg;
    
extern void LedAlarm(tLED_REG *p);

#endif 

//================================================================================
// End of file.
//================================================================================
